package com.teamin.entity;

import com.teamin.service.FileService;
import com.teamin.service.impl.FileServiceImpl;
import io.swagger.annotations.ApiModelProperty;

/**
 * 网盘实体类
 * <p>
 * Created by e on 2017/11/21
 */
public class NetDisk {
    @ApiModelProperty(value = "文件唯一ID")
    private Long id;                // bigint(20) NOT NULL AUTO_INCREMENT,
    @ApiModelProperty(value = "圈子唯一ID")
    private Integer circleid;                // int(11) NOT NULL DEFAULT '-1',
    @ApiModelProperty(value = "0 目录，1 文件")
    private Integer isFile;                // tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 目录，1 文件',
    @ApiModelProperty(value = "文件(夹)名称")
    private String fileName;                // varchar(20) NOT NULL DEFAULT '' COMMENT '文件(夹)名称',
    @ApiModelProperty(value = "0是根目录")
    private Long parentId;                // int(5) NOT NULL DEFAULT '0' COMMENT '0是根目录',
    @ApiModelProperty(value = "uuid")
    private String uuid;                // varchar(50) NOT NULL DEFAULT '-1' COMMENT 'ali uuid',
    @ApiModelProperty(value = "文件大小")
    private Long fileSize;                // int(11) DEFAULT '0' COMMENT '文件大小',
    @ApiModelProperty(value = "文件后缀")
    private String suffix;                // varchar(10) DEFAULT '' COMMENT '文件后缀',
    private String createtime;                // datetime DEFAULT CURRENT_TIMESTAMP,
    private Long createUserid;                // bigint(11) NOT NULL DEFAULT '-1',
    private String updatetime;                // datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    private Long updateUserid;                // bigint(11) NOT NULL DEFAULT '-1',
    private Integer isdelete;                // smallint(6) DEFAULT '0' COMMENT '0 未删除，1 删除',

    @ApiModelProperty(value = "缩略图地址")
    private String thumbnailUrl;
    @ApiModelProperty(value = "子文件数量")
    private Integer fileCount;
    @ApiModelProperty(value = "子文件总大小")
    private Long totalSize;

    @ApiModelProperty(value = "创建人")
    private String createUserName;
    @ApiModelProperty(value = "修改人")
    private String updateUserName;

    @ApiModelProperty(value = "文件URL")
    private String fileUrl;

    private String userName;
    private String userUpdateName;

    @ApiModelProperty(value = "0 本人 1 非本人")
    private Integer self;

    private String screen;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getCircleid() {
        return circleid;
    }

    public void setCircleid(Integer circleid) {
        this.circleid = circleid;
    }

    public Integer getIsFile() {
        return isFile;
    }

    public void setIsFile(Integer isFile) {
        this.isFile = isFile;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }

    public String getCreatetime() {
        return createtime;
    }

    public void setCreatetime(String createtime) {
        this.createtime = createtime;
    }

    public Long getCreateUserid() {
        return createUserid;
    }

    public void setCreateUserid(Long createUserid) {
        this.createUserid = createUserid;
    }

    public String getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(String updatetime) {
        this.updatetime = updatetime;
    }

    public Long getUpdateUserid() {
        return updateUserid;
    }

    public void setUpdateUserid(Long updateUserid) {
        this.updateUserid = updateUserid;
    }

    public Integer getIsdelete() {
        return isdelete;
    }

    public void setIsdelete(Integer isdelete) {
        this.isdelete = isdelete;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public Integer getFileCount() {
        return fileCount;
    }

    public void setFileCount(Integer fileCount) {
        this.fileCount = fileCount;
    }

    public Long getTotalSize() {
        return totalSize;
    }

    public void setTotalSize(Long totalSize) {
        this.totalSize = totalSize;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public String getCreateUserName() {
        return createUserName;
    }

    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }

    public String getUpdateUserName() {
        return updateUserName;
    }

    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }

    public String getThumbnailUrl() {
        FileService fileService = new FileServiceImpl();
        if (getIsFile() != null && getUuid() != null) {
            if (1 == getIsFile() && !"-1".equals(getUuid())) {
                return fileService.getFileThumbnail(getUuid(), getFileName());
            }
        }
        return "";
    }

    public String getFileUrl() {
        return fileUrl;
    }

    public void setFileUrl(String fileUrl) {
        this.fileUrl = fileUrl;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserUpdateName() {
        return userUpdateName;
    }

    public void setUserUpdateName(String userUpdateName) {
        this.userUpdateName = userUpdateName;
    }

    public Integer getSelf() {
        return self;
    }

    public void setSelf(Integer self) {
        this.self = self;
    }

    public String getScreen() {
        return screen;
    }

    public void setScreen(String screen) {
        this.screen = screen;
    }

    @Override
    public String toString() {
        return "NetDisk{" +
                "id=" + id +
                ", circleid=" + circleid +
                ", isFile=" + isFile +
                ", fileName='" + fileName + '\'' +
                ", parentId=" + parentId +
                ", uuid='" + uuid + '\'' +
                ", fileSize=" + fileSize +
                ", suffix='" + suffix + '\'' +
                ", createtime='" + createtime + '\'' +
                ", createUserid=" + createUserid +
                ", updatetime='" + updatetime + '\'' +
                ", updateUserid=" + updateUserid +
                ", isdelete=" + isdelete +
                ", thumbnailUrl='" + thumbnailUrl + '\'' +
                ", fileCount=" + fileCount +
                ", totalSize=" + totalSize +
                ", createUserName='" + createUserName + '\'' +
                ", updateUserName='" + updateUserName + '\'' +
                ", fileUrl='" + fileUrl + '\'' +
                ", userName='" + userName + '\'' +
                ", userUpdateName='" + userUpdateName + '\'' +
                ", self=" + self +
                '}';
    }
}
